<!doctype html>

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <title>随机取人</title>
    <link rel="stylesheet" href="dist/style/weui.css"/>
    <link rel="stylesheet" href="index.css"/>
    <script src="dist/example/zepto.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript" src="dist/weui.js"></script>
</head>

<body oncontextmenu=self.event.returnValue=false>
<div class="page">
    <div class="weui-form">
        <div class="weui-form__text-area">
            <h2 class="weui-form__title">已添加到库的列表</h2>
        </div>
        <div class="weui-form__control-area">
            <div class="weui-cells__group weui-cells__group_form">
                <div class="weui-cells__title">随机列表</div>
                <div class="weui-cells" id="rlist">

                </div>
            </div>
        </div>
    </div>

    <div class="weui-form__opr-area">
        <a class="weui-btn weui-btn_primary" href="javascript:turnback()" id="showTooltips">确定</a>
    </div>
</div>
</div>
<script>
    let list = [];
    $.ajax({
        type: "post",
        url: "http://39.101.190.160:8000/getlistname/",
        async: false,
        success: function (res) {
            list = res.array;
        },
        error: function (res) {
            console.log(res);
        },
        complete: function (res) {
        }
    });
    document.getElementById('rlist').innerHTML = '<a class="weui-cell  weui-cell_access" href="javascript:select(-1);"><div class="weui-cell__bd"><p>197612全体名单</p></div><div class="weui-cell__ft"></div></a>';
    for (let i = 0; i < list.length; i++) {
        document.getElementById('rlist').innerHTML += '<a class="weui-cell  weui-cell_access" href="javascript:select(' +
            list[i][0] + ');"><div class="weui-cell__bd"><p>' +
            list[i][1] + '</p></div><div class="weui-cell__ft"></div></a>';
    }

    function select(e) {
        if (e == -1) {
            weui.alert('不能查看全体名单哦');
            return;
        }
        window.open('viewname.html?id=' + e, '_self');
    }

    function turnback() {
        window.open('index.html', '_self');
    }
</script>

<script Language="JavaScript">
    function click() {
        if (event.button == 2 || event.button == 3) {
            weui.alert('复制用Control+C哦')
        }
    }

    document.onmousedown = click
</script>
</body>
</html>
